<template>
  <div>
    <van-popup
      :value="timeModal"
      round
      position="bottom"
      :style="{ height: '40%' }"
    >
      <van-datetime-picker
        v-model="currentDate"
        type="date"
        :min-date="minDate"
        :title="titleDate"
        @confirm="dateModalConfrim"
        @cancel="cancel"
      />
    </van-popup>
  </div>
</template>
<script>
export default {
  name: 'time-picker-modal',
  props: {
    timeModal: {
      type: Boolean,
      default: false
    },
    titleDate: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      minDate: new Date(2022, 0, 1),
      currentDate: new Date()
    }
  },
  methods: {
    dateModalConfrim (value) {
      this.$emit('dateModalConfrim', value)
    },
    cancel () {
      this.$emit('cancel')
    }
  }
}
</script>
<style lang="less" scoped>
</style>
